package com.aglhz.nature.view;

import java.util.List;



import com.aglhz.base.BaseActivity;
import com.aglhz.nature.R;
import com.aglhz.nature.adapter.ShopListAdapter;
import com.aglhz.nature.modle.item.ShopListData;
import com.aglhz.nature.presenter.ShopListPresenter;
import com.aglhz.nature.view.iv.ShopListView;



import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ListView;
/**
 * 商品列表，有什么传什么，多个界面用到
 * @author Administrator
 *
 */
public class ShopListActivity extends BaseActivity implements ShopListView{
	//url拼接可能用到的数据
	private String categoryId="";
	private String brandId="";
	private String  name="";
	private String categoryTemplateId="";
	private int recommendGoodsId;
	private int page;
	private String editAround;
	private ShopListPresenter presenter;
	private ShopListAdapter adapter;
	private SharedPreferences sharedPreferences;
	private String token;
	private ListView shoplist_listView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.shoplist);
		setActionBarTitle("商品列表");
		shoplist_listView=(ListView) findViewById(R.id.shoplist_listView);
		Intent intent=getIntent();
		brandId=intent.getStringExtra("BrandIntroductionActivity");
		name=intent.getStringExtra("SeachActivity");
		editAround=intent.getStringExtra("AroundActivity");
		
	
		presenter = new ShopListPresenter(this);
		// basePresenter register
		presenter.register();
		
		try {
			presenter.loadData();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
	@Override
	public void showList(List<ShopListData> data) {
		adapter=new ShopListAdapter(data,ShopListActivity.this);
		shoplist_listView.setAdapter(adapter);
		
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
		presenter.unregister();
	}


	@Override
	public String getCategoryId() {
		return categoryId;
	}


	@Override
	public String getBrandId() {
		return brandId;
	}


	@Override
	public String getName() {
		return name;
	}


	@Override
	public String getCategoryTemplateId() {
		return categoryTemplateId;
	}


	@Override
	public String getAroundInfo() {
	
		return editAround;
	}


	@Override
	public String getToken() {
		// TODO Auto-generated method stub
		return token;
	}




}
